#ifndef ANTIANAPHYLAXIS_QUEUE_H
#define ANTIANAPHYLAXIS_QUEUE_H

#include "eventcommand.h"
#include "data_structure.h"
#include "data_record.h"
#include "yaml-cpp/yaml.h"
#include "filemanager.h"
#include "encode_srv.pb.h"
using namespace std;
class adr_component;
/** 视频脱敏队列
 *
 */
namespace DcAdr
{
    typedef enum ANTPL_WORKING_STATUS
    {
        NONE = 0,
        WORKING = 1,
        RECEIVING = 2,
    } ANTPL_WORKING_STATUS;
    typedef struct AnTpl_Que_Info
    {
        string befFile;
        string afterFile;
        string taskid;
        int level;
    } AnTpl_Que_Info;

    class AntianaphylaxisQueue : public EventCommand
    {
    public:
        static AntianaphylaxisQueue &getInstance();

        void setPublishHandle(adr_component *component);

        void addQueue();
        void sendUploadStatus2Sts(bool flag);

        void dealQueue();

        //接收脱敏数据
        bool receiveDesensData(const ProtoData &data);

        bool getOneFile(std::string &filePath, std::string &afterFilePath);

        void writeFileName(std::string befor, std::string after,int level);
        void findAndWriteTaskidInFile(const std::string &filePath, const std::string &taskId);
        bool JudgeIsIFrame(std::string &topic,EncodeSrv::EncodeH265 &enc,std::map<std::string,bool> &isIframeMap);

    private:
        AntianaphylaxisQueue(/* args */);
        ~AntianaphylaxisQueue();

        //脱敏工作状态
        ANTPL_WORKING_STATUS m_antplStats{ANTPL_WORKING_STATUS::NONE};
        adr_component *m_component{nullptr};
        DataRecord *m_record{nullptr};
        YAML::Node m_config;
        int m_times = 0;

        bool m_hasDealed = false; //处理过脱敏数据；
        bool m_get6 = false; //收到状态机的离线上云信号；
        bool m_get6_before =false; //状态机的离线上云信号前一个状态

        AnTpl_Que_Info m_curretDealFile;
    };
}

#endif // ANTIANAPHYLAXIS_QUEUE_H